]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
main, util: Notify systemd once we are fully initialised
authorIain Lane <iainl@gnome.org>
Fri, 4 Oct 2019 11:11:06 +0000 (12:11 +0100)
committerJonas Ådahl <jadahl@gmail.com>
Fri, 4 Oct 2019 15:40:05 +0000 (15:40 +0000)
If graphical applications want to start from systemd units, they need to
start after we're properly ready to display them. This is particularly
important under X where `_GTK_FRAME_EXTENTS` and other xprops are needed
to have the right theming.

We're doing this in an idle callback so that the dynamic starting of
`gnome-session-x11-service.target` (which launches `gsd-xsettings`) as
the result of a signal emission happens before us signalling we're ready
for later things to start.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/750

js/ui/main.js
src/main.c
src/shell-util.c
src/shell-util.h

index e8269f09be00a19beabe55b3f1d021169b0605b5..17f5bc716db3a6b4e790cba9c219d93262e76783 100644 (file)
@@ -229,7 +229,11 @@ function _initializeUI() {
     EndSessionDialog.init();
 
     // We're ready for the session manager to move to the next phase
-    Meta.register_with_session();
+    GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
+        Shell.util_sd_notify();
+        Meta.register_with_session();
+        return GLib.SOURCE_REMOVE;
+    });
 
     _startDate = new Date();
 
index 489026b76573d7e4e25729401e005e5f66d7d0c6..6faf9934fb67d31251ca30f0384325e8583195a2 100644 (file)
 #include "shell-perf-log.h"
 #include "st.h"
 
-#ifdef HAVE_SYSTEMD
-#include <systemd/sd-daemon.h>
-#else
-/* So we don't need to add ifdef's everywhere */
-#define sd_notify(u, m)            do {} while (0)
-#define sd_notifyf(u, m, ...)      do {} while (0)
-#endif
-
 extern GType gnome_shell_plugin_get_type (void);
 
 #define SHELL_DBUS_SERVICE "org.gnome.Shell"
@@ -532,9 +524,6 @@ main (int argc, char **argv)
   shell_init_debug (g_getenv ("SHELL_DEBUG"));
 
   shell_dbus_init (meta_get_replace_current_wm ());
-  /* We only use NOTIFY_SOCKET exactly once; unset it so it doesn't remain in
-   * our environment. */
-  sd_notify (1, "READY=1");
   shell_a11y_init ();
   shell_perf_log_init ();
   shell_introspection_init ();
index c22dd1c6e50848caded278300fe49a1ef16f4e7e..f93462c73ebfe8cd93ea9e6d3c09207b6f4510a4 100644 (file)
 #include <langinfo.h>
 #endif
 
+#ifdef HAVE_SYSTEMD
+#include <systemd/sd-daemon.h>
+#else
+/* So we don't need to add ifdef's everywhere */
+#define sd_notify(u, m)            do {} while (0)
+#define sd_notifyf(u, m, ...)      do {} while (0)
+#endif
+
 static void
 stop_pick (ClutterActor       *actor,
            const ClutterColor *color)
@@ -659,3 +667,11 @@ shell_util_stop_systemd_unit (const char  *unit,
 {
   return shell_util_systemd_call ("StopUnit", unit, mode, error);
 }
+
+void
+shell_util_sd_notify (void)
+{
+  /* We only use NOTIFY_SOCKET exactly once; unset it so it doesn't remain in
+   * our environment. */
+  sd_notify (1, "READY=1");
+}
index c41e02c79888fef6419bf8e520b957aa7087add0..4453beb4a5b069759c9001f9202fbb7d433d553b 100644 (file)
@@ -66,6 +66,8 @@ gboolean shell_util_stop_systemd_unit  (const char  *unit,
                                         const char  *mode,
                                         GError     **error);
 
+void shell_util_sd_notify (void);
+
 G_END_DECLS
 
 #endif /* __SHELL_UTIL_H__ */